package com.colbby.datahouse.transform;

import com.colbby.datahouse.utils.CastUtils;
import com.colbby.datahouse.utils.TypeDescriptor;
import com.colbby.datahouse.utils.TypeUtils;

public class StringTransformer implements DataTypeTransform<String> {

	public static final StringTransformer INSTANCE = new StringTransformer();
	
	@Override
	public String transform(TypeDescriptor returnType, Object value) {
		return String.valueOf(CastUtils.getValue(value));
	}

	@Override
	public boolean shouldDo(TypeDescriptor returnType, Object value) {
		return TypeUtils.isSuperClass(String.class, returnType.getTypeClass());
	}
}
